# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Datastore.V1.Model.RunAggregationQueryRequest do
  @moduledoc """
  The request for Datastore.RunAggregationQuery.

  ## Attributes

  *   `aggregationQuery` (*type:* `GoogleApi.Datastore.V1.Model.AggregationQuery.t`, *default:* `nil`) - The query to run.
  *   `databaseId` (*type:* `String.t`, *default:* `nil`) - The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database.
  *   `explainOptions` (*type:* `GoogleApi.Datastore.V1.Model.ExplainOptions.t`, *default:* `nil`) - Optional. Explain options for the query. If set, additional query statistics will be returned. If not, only query results will be returned.
  *   `gqlQuery` (*type:* `GoogleApi.Datastore.V1.Model.GqlQuery.t`, *default:* `nil`) - The GQL query to run. This query must be an aggregation query.
  *   `partitionId` (*type:* `GoogleApi.Datastore.V1.Model.PartitionId.t`, *default:* `nil`) - Entities are partitioned into subsets, identified by a partition ID. Queries are scoped to a single partition. This partition ID is normalized with the standard default context partition ID.
  *   `readOptions` (*type:* `GoogleApi.Datastore.V1.Model.ReadOptions.t`, *default:* `nil`) - The options for this query.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :aggregationQuery => GoogleApi.Datastore.V1.Model.AggregationQuery.t() | nil,
          :databaseId => String.t() | nil,
          :explainOptions => GoogleApi.Datastore.V1.Model.ExplainOptions.t() | nil,
          :gqlQuery => GoogleApi.Datastore.V1.Model.GqlQuery.t() | nil,
          :partitionId => GoogleApi.Datastore.V1.Model.PartitionId.t() | nil,
          :readOptions => GoogleApi.Datastore.V1.Model.ReadOptions.t() | nil
        }

  field(:aggregationQuery, as: GoogleApi.Datastore.V1.Model.AggregationQuery)
  field(:databaseId)
  field(:explainOptions, as: GoogleApi.Datastore.V1.Model.ExplainOptions)
  field(:gqlQuery, as: GoogleApi.Datastore.V1.Model.GqlQuery)
  field(:partitionId, as: GoogleApi.Datastore.V1.Model.PartitionId)
  field(:readOptions, as: GoogleApi.Datastore.V1.Model.ReadOptions)
end

defimpl Poison.Decoder, for: GoogleApi.Datastore.V1.Model.RunAggregationQueryRequest do
  def decode(value, options) do
    GoogleApi.Datastore.V1.Model.RunAggregationQueryRequest.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Datastore.V1.Model.RunAggregationQueryRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
